﻿<UserControl x:Class="WpfRcp.Logging.Log4Net.Controls.Log4NetLoggerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Helpers="clr-namespace:WpfRcp.Helpers;assembly=WpfRcp"
             xmlns:Windows="clr-namespace:WpfRcp.Views.Windows;assembly=WpfRcp"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">

    <UserControl.Resources>
        <Windows:DateTimeValueConverter x:Key="dateTimeValueConverter" />
    </UserControl.Resources>
    
    <Grid>
        <ListView ItemsSource="{Binding ReadOnlyLogEntries}">

            <ListView.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="{Binding Source={x:Static Helpers:ResHelper.Instance}, Path=Resource[ClearLogMenuItem]}" Command="{Binding ClearLogCommand}">
                    </MenuItem>
                </ContextMenu>
            </ListView.ContextMenu>

            <ListView.View>
                <GridView ColumnHeaderContainerStyle="{StaticResource GridViewColumnHeaderStyle}">
                    <GridViewColumn Header="{Binding Source={x:Static Helpers:ResHelper.Instance}, Path=Resource[TimeStamp]}">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding TimeStamp, Converter={StaticResource dateTimeValueConverter}}" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn Header="{Binding Source={x:Static Helpers:ResHelper.Instance}, Path=Resource[Message]}" DisplayMemberBinding="{Binding Message}" />
                    <GridViewColumn Header="{Binding Source={x:Static Helpers:ResHelper.Instance}, Path=Resource[Category]}" DisplayMemberBinding="{Binding Level}" />
                    <GridViewColumn Header="{Binding Source={x:Static Helpers:ResHelper.Instance}, Path=Resource[AppDomain]}" DisplayMemberBinding="{Binding Domain}" />
                    <GridViewColumn Header="{Binding Source={x:Static Helpers:ResHelper.Instance}, Path=Resource[ThreadName]}" DisplayMemberBinding="{Binding ThreadName}" />
                </GridView>
            </ListView.View>

        </ListView>
    </Grid>
</UserControl>
